<?php
namespace Admin\Controller;

class ProjectMeetingController extends AbstractController  {
	
	protected $From;

	public function _initialize(){
		$this->assign("busid",I("busid"));
		$this->assign("formid",I("formid"));
		$this->Form = D('meeting');
    }
	
    public function index(){
    	$id = (int)I('id');
    	$this->assign("projectID",$id);
    	$res = $this->Form->MyshowList();
		$this->assign("list",$res['list']);
    	$this->assign("page",$res['page']);
    	$this->display("Project/ProjectMeeting/index");
    }
	
	public function save($type = false){
		if($type != false){
			if($type == "add"){
				if(!$this->Form->create()){
					exit($this->error($this->Form->getError()));
				}else{
					$result = $this->Form->add();
					if($result){
						$this->success('添加成功！');
					}else{
						$this->error('添加错误！');
					}
				}
			}else if($type == "edit"){
				if(I('id')){
					$res = $this->Form->Myshow(array("ID" => (int)I('id')));
					$this->assign("editdata",$res[0]);
					$this->assign("data",$this->Form->getProjectList());
				}
				$this->assign("editdata",$res[0]);
				$this->display("Project/ProjectMeeting/save");
			}else if($type == "update"){
				$result = $this->Form->Myupdata();
				if($result['state'] == 1 && !empty($result)){
					$this->success($result['msg']);
				}else if($result['state'] == 0 && !empty($result)){
					$this->error($result['msg']);
				}
			}
		}else{
			$res = $this->Form->getProjectList();
			$this->assign("data",$res);
			$this->display("Project/ProjectMeeting/save");
		}
	}
}